var audioElement = document.getElementById('backgroundMusic');
var controlElement = document.getElementById('audioControl');


// 播放音频
function playAudio() {
    audioElement.play();
}

// 切换音频播放/暂停
function toggleAudio() {
    if (audioElement.paused) {
        audioElement.play();
        controlElement.style.backgroundImage = "url('/static/img/index-bgm-playing.png')";
    } else {
        audioElement.pause();
        controlElement.style.backgroundImage = "url('/static/img/index-bgm-muted.png')";
    }
}


// 添加点击事件监听器
controlElement.addEventListener('click', toggleAudio);